package com.smartfast4j.backend.modules.sys.security.shiro;

import org.apache.log4j.Logger;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListenerAdapter;

/**
 * 会话监听器
 * 会话监听器用于监听会话创建、过期及停止事件：
 * Created by gacl on 2017/9/7.
 */
public class SessionListener extends SessionListenerAdapter {

    private static final Logger logger = Logger.getLogger(SessionListener.class);

    @Override
    public void onStart(Session session) {//会话创建时触发
        logger.info("会话创建：" + session.getId());
    }
    @Override
    public void onExpiration(Session session) {//会话过期时触发
        logger.info("会话过期：" + session.getId());
    }
    @Override
    public void onStop(Session session) {//退出/会话过期时触发
        logger.info("会话停止：" + session.getId());
    }
}
